import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class MusicsAndSoundsConfig
    
    export  class MusicsAndSoundsConfig
    {
        constructor()
        {
            
            this._musicsDic = new Map<any, any> /* flash.utils.Dictionary */();
            this._soundsDic = new Map<any, any> /* flash.utils.Dictionary */();
            if (MusicsAndSoundsConfig._instance != null) 
            {
                throw new Error(" MusicsAndSoundsConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc3=null;
            var loc4=null;
            var loc1=arg1["musics"]["music"] as Array<any>;
            var loc2=arg1["sounds"]["sound"] as Array<any>;
            var loc5=0;
            var loc6=loc1;
            for(loc3 of loc6) 
            {
                loc4 = loc3.mapId + "_" + loc3.sceneName;
                this._musicsDic[loc4] = loc3.fileName;
            }
            loc5 = 0;
            loc6 = loc2;
            for(loc3 of loc6) 
            {
                this._soundsDic[loc3.type] = loc3.fileName;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("musicsAndSounds.xml");
            this.write(loc1);
            return;
        }

        public getMusicFileNameByMapId(arg1: int, arg2: string=""): string
        {
            return this._musicsDic[arg1 + "_" + arg2] as string;
        }

        public getSoundFileNameByType(arg1: string): string
        {
            return this._soundsDic[arg1] as string;
        }

        public static get instance(): MusicsAndSoundsConfig
        {
            if (MusicsAndSoundsConfig._instance == null) 
            {
                MusicsAndSoundsConfig._instance = new MusicsAndSoundsConfig();
            }
            return MusicsAndSoundsConfig._instance;
        }

        /* internal */ /* var */_musicsDic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_soundsDic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: MusicsAndSoundsConfig;
    }
